﻿Module Module1
    Function Bai21(ByVal n As Integer) As Integer
        Dim S As Integer
        Dim i As Integer
        For i = 1 To n Step 1
            If (n Mod i = 0) Then
                S = S + i
            End If
        Next
        Return S
    End Function
    Sub Main()
        Dim n, kq As Integer
        Console.WriteLine("Nhap So n: ")
        n = Console.ReadLine()
        kq = Bai21(n)
        Console.WriteLine("Tong Tat Ca Cac Uoc So Cua {0}: {1}", n, kq)
    End Sub
End Module
